﻿@page
@model XZTZ.UMP.WEB.Pages.Base.CompanyInfo.IndexModel

@{
    ViewData["Title"] = "Index";
}

<h1>单位信息</h1>

<p>
    <a asp-page="Create">新增</a>
</p>
<form asp-page="./Index" method="get">
    <div class="form-actions no-color">
        <p>
            查询：
            <input type="text" name="SearchString" value="@Model.CurrentFilter" />
            <input type="submit" value="搜索" class="btn btn-default" /> |
            <a asp-page="./Index">返回完整列表</a>
        </p>
    </div>
</form>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].CompanyType)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].strCompanyName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].strShortName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].strCommissary)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].strPhone)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].strFax)
            </th>
            <th>
                <a asp-page="./Index" asp-route-sortOrder="@Model.DateSort" asp-route-currentFilter="@Model.CurrentFilter">
                    @Html.DisplayNameFor(model => model.CompanyInfo[0].dtmOperateDate)
                </a>
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].strNote)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].intIndexNo)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CompanyInfo[0].blnTabooFlag)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model.CompanyInfo)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.CompanyType.strTypeName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.strCompanyName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.strShortName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.strCommissary)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.strPhone)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.strFax)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.dtmOperateDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.strNote)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.intIndexNo)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.blnTabooFlag)
                </td>
                <td>
                    <a asp-page="./Edit" asp-route-id="@item.guidCompanyID">Edit</a> |
                    <a asp-page="./Details" asp-route-id="@item.guidCompanyID">Details</a> |
                    <a asp-page="./Delete" asp-route-id="@item.guidCompanyID">Delete</a>
                </td>
            </tr>
        }
    </tbody>
</table>
@{
    var prevDisabled = !Model.CompanyInfo.HasPreviousPage ? "disabled" : "";
    var nextDisabled = !Model.CompanyInfo.HasNextPage ? "disabled" : "";
}


<ul class="pagination pagination-lg">
    @*<li><a href="#">&laquo;</a></li>*@
    <li>
        <a asp-page="./Index"
           asp-route-sortOrder="@Model.CurrentSort"
           asp-route-pageIndex="1"
           asp-route-currentFilter="@Model.CurrentFilter"
           class="btn btn-default @prevDisabled">
            首页
        </a>
    </li>
    <li>
        <a asp-page="./Index"
           asp-route-sortOrder="@Model.CurrentSort"
           asp-route-pageIndex="@(Model.CompanyInfo.PageIndex - 1)"
           asp-route-currentFilter="@Model.CurrentFilter"
           class="btn btn-default @prevDisabled">
            上一页
        </a>
    </li>
    @for (var i = 1; i <= @Model.CompanyInfo.TotalPages; i++)
    {
        <li>
            <a asp-page="./Index"
               asp-route-sortOrder="@Model.CurrentSort"
               asp-route-pageIndex="@i"
               asp-route-currentFilter="@Model.CurrentFilter"
               class="btn btn-default @nextDisabled">@i</a>
        </li>
    }
    <li>
        <a asp-page="./Index"
           asp-route-sortOrder="@Model.CurrentSort"
           asp-route-pageIndex="@(Model.CompanyInfo.PageIndex + 1)"
           asp-route-currentFilter="@Model.CurrentFilter"
           class="btn btn-default @nextDisabled">下一页</a>
    </li>
    <li>
        <a asp-page="./Index"
           asp-route-sortOrder="@Model.CurrentSort"
           asp-route-pageIndex="@Model.CompanyInfo.TotalPages"
           asp-route-currentFilter="@Model.CurrentFilter"
           class="btn btn-default @nextDisabled">末页</a>
    </li>
    <li>
        <input type="text" value="@Model.CompanyInfo.PageIndex" style="width:20px;" /><span>/</span><span>@Model.CompanyInfo.TotalPages</span>
    </li>
</ul>